<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page language="java"    import="com.baosight.iplat4j.upload.*,
                                    com.baosight.iplat4j.er.util.*,
									com.baosight.iplat4j.dao.*,
									com.baosight.iplat4j.common.er.domain.*,
									java.util.HashMap,
									java.util.Map,
									java.io.*,
									com.baosight.iplat4j.core.threadlocal.*,
									com.baosight.iplat4j.ec.util.*,
									com.baosight.iplat4j.util.*,
									java.util.*,
									com.baosight.iplat4j.core.ei.EiInfo,
									com.baosight.iplat4j.core.ei.EiConstant,
									com.baosight.iplat4j.ec.tm.utils.ECTMUtils,
									com.baosight.iplat4j.core.soa.SoaManager,
									com.baosight.iplat4j.core.FrameworkInfo,
									com.baosight.iplat4j.util.PlatUtils,
									java.lang.String,
									com.baosight.ieasyflow.util.*,
									net.sf.json.*,
									java.text.*"%>
<html>
<EF:EFHead includeDefault="true">
</EF:EFHead>
<EF:EFBody>
<% 
	FileUploadBean Bean = new FileUploadBean(); 
	Bean.setUploadFiletype("xls,doc,ppt,xlsx,docx,pptx,txt,pdf,zip,rar,7zip,jpg,jepg,gif,png");
	Bean.setUploadType("uploadToServer");
	Bean.setUploadMaxSize(1024*1024*6);
	Bean.setUploadThresholdSize(1024*4);
//	String toFile=com.baosight.iplat4j.core.resource.I18nMessages.getText("sczx.updownload.uploadfilekeepeddir");
	String uploadPath="upload";
	String toFile=request.getSession().getServletContext().getRealPath(uploadPath)+"/"; 
	File dirFile = new File(toFile);
	if ( ! (dirFile.exists()) && !(dirFile.isDirectory())) dirFile.mkdirs(); 
	Bean.setUploadFileKeepedDir(toFile); 
	Date dt = new Date();
    DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
    df.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
	String prefix=df.format(dt)+"-";
	Bean.setUploadChangedName(prefix);
	
	
 
	FileUploadManager manager = new FileUploadManager(Bean);
	manager.execute(pageContext);
	 
	pageContext.getResponse().flushBuffer();
	String file_oldname=Bean.getUploadFileName().substring(Bean.getUploadFileName().indexOf("-")+1);
%> 
<font color="red" > <%=request.getAttribute("upload_message") %> </font>
<input id='filename' type="hidden" value="<%=Bean.getUploadFileName()%>"> 
<hr>
<br>    
<script> 
	window.opener.uploadSuc('<%=Bean.isStatues()%>','<%=Bean.getUploadFileName()%>','<%=file_oldname%>','<%=Bean.getUploadThresholdSize()%>');
	window.close();  
</script>  
</EF:EFBody> 
</html>
